<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1">

  <meta name="csrf-token" content="{{ csrf_token() }}" />

  <link rel="stylesheet" href="{{url('js/admin/bootstrap.min.css')}}">

  <script type="text/javascript" src="{{url('bootstrap/js/bootstrap.min.js')}}"></script>
  <script type="text/javascript" src="{{url('bootstrap/js/jquery.min.js')}}"></script>
  <script type="text/javascript" src="{{url('bootstrap/js/bootstrap.js')}}"></script>

    <title>找回帐号密码</title>
    <link href="{{url('css/login/frame-zhao.css')}}" type="text/css" rel="stylesheet">
    <link href="{{url('css/login/iforgot_index.css')}}" type="text/css" rel="stylesheet">
    <link href="{{url('css/login/skin-zhao.css')}}" type="text/css" rel="stylesheet">
    <script type="text/javascript" src="{{url('js/home/jQuery1.7.1-zhao.js')}}"></script>
    <script type="text/javascript" src="{{url('js/home/base-zhao.js')}}"></script>
<style>
    .hid{
        display:none;
    }
</style></head>

<body style="background-color:#C3D3EB">
<div class="WB_miniblog">
    <!-- 首页 -->
    <div class="iforgot_bd">
        <div class="iforgot_header clearfix">
                        <div class="logo_mod W_fl">  <img src="{{url('img/home/login/big-logo.png')}}" alt="" width="100px">  </div>
                        <div class="name_mod W_fr">
                <a href="http://www.sina.com.cn/" class="S_txt1">新浪首页</a>
                <a href="http://weibo.com/" class="S_txt1">微博</a>
                <a href="http://help.weibo.com/" class="S_txt1 last">帮助</a>
            </div>
        </div><div class="iforgot_cont">
    <div class="i_top">
        <h3 class="title">找回帐号密码</h3>
    </div>
    <div class="i_mod">
        <div class="form_mod">
            <ul class="form_list">


            <!-- Modal -->


    <form action="{{url('modify')}}" method="post">

        {{csrf_field()}}

            <div class="" style="margin-left:20%;">

                  <div class="input-group" style="width:160px;height: 2px;margin-left: 70px;margin-top: 8px;margin-bottom: 5px">
                <span class="input-group-addon" id="basic-addon1" style="width: 50px"  >输入手机号码</span>
                <input type="text"  name="tel" id="z_tel" class="form-control" maxlength="11" placeholder="your number" aria-describedby="basic-addon1" style="width: 200px;">
              </div>



              <!-- {{--密保--}} -->
              <div class="input-group" style="width:160px;height: 2px;margin-left: 70px;margin-top: 8px;margin-bottom: 5px">
                <span class="input-group-addon" id="basic-addon1" style="width: 30px" >选择你的密保问题</span>
                <select name="problem" id="pro" class="form-control" style="width: 172px;">
                  <option value="我的名字">我的名字</option>
                  <option value="毕业哪个学校">毕业哪个学校</option>
                  <option value="我的高三班主任">我的高三班主任</option>
                </select>
              </div>

              <!-- {{--end 密保--}} -->

              <!-- {{--答案--}} -->
              <div class="input-group" style="width:160px;height: 2px;margin-left: 70px;margin-top: 8px;margin-bottom: 5px">
               <span class="input-group-addon" id="basic-addon1" style="width: 50px" >输入你的答案</span>
                <input type="text"  name="papers" id="answer" class="form-control" placeholder="your answer" aria-describedby="basic-addon1" style="width: 200px;">
              </div>

               <p style="margin-left: 310px;margin-top: 8px;margin-bottom: 5px;color:red;font-size:13px;display:none; cursor:pointer;" id="p1" >* 点击验证</p>
                <a href="#" style="text-decoration:none;"><p style="margin-left: 250px;margin-top: 8px;margin-bottom: 5px;color:#2CF72C; font-size:13px;display:none;" id="p2">* 验证通过,输入新密码</p></a>




                <div class="input-group" style="width:;height: 2px;margin-left: 70px;margin-top: 8px;margin-bottom: 5px;display:;" id="newpwd">
                <span class="input-group-addon" id="basic-addon1" style="width: 50px" >请输入新密码</span>
               <span> <input type="text"  name="ru_pwd" id="npwd" class="form-control" placeholder="Newly included" aria-describedby="basic-addon1" style="width: 200px; " disabled="disabled" title="请先验证">
              </div></span>


            </div>

        <input type="hidden" name="u_id" value="" id="upid">


            <div class="modal-footer">
             {{--<span id="ao"> <button type="button" class="btn btn-primary" data-dismiss="modal" id="bbt" disabled="disabled">保存</button></span>--}}
                <button class="btn btn-primary" id="bbt" disabled="disabled">   提交</button>

    </form>





            </ul>
        </div>
    </div>
</div>
</div>
</div>
<div class="WB_footer S_bg2">
        <div class="other_link S_bg1 clearfix T_add_ser"  >

        <div style="margin-left:26%">
            
        <p class="copy"><a href="" class="footBg">关于微博</a>　<a class="footBg" href="">微博帮助</a>　<a class="footBg" href="">意见反馈</a>　<a class="footBg" href="">开放平台</a>　<a class="footBg" href="">微博招聘</a>　<a class="footBg" href="">新浪网导航</a>　<a class="footBg" href="">社区管理中心</a>　<a class="footBg" href="">微博社区公约</a></p>
        <div class="copy"><a href="" class="S_txt2"> 客服电话：4000 960 960(个人) 4000 980 980(企业) (按当地市话标准计算)</a></div>
        <p class="company"><span class="copy S_txt2">Copyright © 1996-2017 SINA 北京微梦创科网络技术有限公司 </span><span><a class="S_txt2" href="">京网文[2014]2046-296号</a> <a class="S_txt2" href="">京ICP证100780号</a> 
              </span></p>
            
        </div>
    </div>
    </div>

</body></html>

<script type="text/javascript">
    

            answer.onkeydown = function(){
                //获取电话值
                var tel = document.getElementById('z_tel').value;
                //获取密保问题值
                var pro =document.getElementById('pro').value;
                //获取答案值
                var ans = document.getElementById('answer').value;

                var p1 = document.getElementById('p1');

                if (ans.length <= 1){

                          //bbt.disabled = true;
                          p1.style.display = 'none';
                          p2.style.display = 'none';
                      }

                      if (ans.length > 1){

                          //bbt.disabled = false;
                          p1.style.display = 'block';
                      }
            }




            npwd.onkeydown = function(){

                //获取答案值
                var ans = document.getElementById('npwd').value;

                if (ans.length <= 1){

                    bbt.disabled = true;
                }

                if (ans.length > 1){

                    bbt.disabled = false;


                }
            }


            p1.onclick =function(){
                //获取电话值
                var tel = document.getElementById('z_tel').value;
                //获取密保问题值
                var pro =document.getElementById('pro').value;
                //获取答案值
                var ans = document.getElementById('answer').value;

                  $.ajax({
                        type:'post',
                        url:'{{url('reset')}}/'+ tel + '/'+ pro + '/'+ ans,
                        headers: {
                                    'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                                },
                        success:function(data){
                                    
                                    console.log(data);

                                    if(data){
                                        if(data[1] == 1){
                                            p1.style.display = 'none';
                                            p2.style.display = 'block';
                                            $('#npwd').removeAttr('disabled');
                                            $('#upid').val(data[0]);
                                        }

                                        if (data == 2){

                                            alert('对不起,密码错误!');
                                        }

                                        if (data == 3){
                                            alert('无此手机号码');
                                        }

                                    }

                         },
                        error:function() {

                            alert('请填写完整资料');
                        }
                 })


            }

            


</script>